package net.qiqbframework.modelling.command.voucher;

import net.qiqbframework.modelling.command.LoadVoucherAnnotation;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class LoadVoucherDefinitionManager {

    private final List<LoadVoucherAnnotation> aggregateBusinessIdVoucherAnnotations = new ArrayList<>();

    private Map<Class<?>, LoadVoucherModel<?>> voucherDefinitionMap = new HashMap<>();

    public <C> LoadVoucherModel<C> getLoadVoucherDefinition(Class<C> voucherClass) {
        if (voucherDefinitionMap.containsKey(voucherClass)) {
            return (LoadVoucherModel<C>) voucherDefinitionMap.get(voucherClass);
        }
        // 解析
        return (LoadVoucherModel<C>) voucherDefinitionMap.get(getClass());
    }
}
